#### Appendix 5: Full Results and Robustness Checks ####

source("./code/loadPackages.R")

## Load environment with main meeting analyses and relevant data
load("./data/meetingAnalysis.RData")

#### Appendix 5.2: Disaggregating Results by Meeting Type ####

# Break down to formal and informal 
nscd_inf = nscd_all %>% filter(formal==0)       # Informal only
nscd_form = nscd_all %>% filter(formal==1)      # Formal only

#### Meeting analysis for formal meetings only ####

## Emergence model
meanFit1af = glm(paste(outcome, "~ meanHawk", "+ factor(admin)", sep=" "),  
                 data=nscd_form, family="poisson")
summary(meanFit1af)

meanFit1bf = glm(paste(outcome, "~ meanHawk", "+", controls, "-formal + presAttend", sep=" "),  
                 data=nscd_form, family="poisson")
summary(meanFit1bf)

meanFit1cf = lm(paste(outDiff, "~ meanHawk", "+ factor(admin)", sep=" "),  
                data=nscd_form)
summary(meanFit1cf)

meanFit1df = lm(paste(outDiff, "~ meanHawk", "+", controls, "-formal + presAttend", sep=" "),  
                data=nscd_form)
summary(meanFit1df)


## Leader model
leaderFit1af = glm(paste(outcome, "~ presHawk", sep=" "),  
                   data=nscd_form, family="poisson")
summary(leaderFit1af)

leaderFit1bf = glm(paste(outcome, "~ presHawk", "+", controls, "-factor(admin) - formal + presAttend", sep=" "),  
                   data=nscd_form, family="poisson")
summary(leaderFit1bf)

leaderFit1cf = lm(paste(outDiff, "~ presHawk", sep=" "),  
                  data=nscd_form)
summary(leaderFit1cf)

leaderFit1df = lm(paste(outDiff, "~ presHawk", "+", controls, "-factor(admin) - formal + presAttend", sep=" "),  
                  data=nscd_form)
summary(leaderFit1df)


#### Table A11: Effect of Mean Participant Hawkishness and President's Hawkishness on Foreign Policy Decisions, Using Formal Meetings ####
stargazer(meanFit1af, meanFit1bf, meanFit1cf, meanFit1df, 
          leaderFit1af, leaderFit1bf, leaderFit1cf, leaderFit1df,
          column.sep.width = "0pt", no.space=T, align=T, df=F,
          omit = c("mention", "admin"),
          omit.stat = c("ll", "rsq", "adj.rsq", "aic", "f", "ser"),
          covariate.labels = c("Mean Hawkishness", 
                               "No. of Attendees", 
                               "Defense", 
                               "Intelligence", 
                               "Military", 
                               "State", 
                               "Diplomatic Experience", 
                               "Intelligence Experience", 
                               "Military Experience", 
                               "5-Year MID Challenges", 
                               "US CINC",
                               "President Attendance",
                               "President's Hawkishness"))


## Adviser model 
compFit1af = glm(paste(outcome, "~ advHawk + presHawk", sep=" "),  
                 data=nscd_form, family="poisson")
summary(compFit1af)

compFit1bf = glm(paste(outcome, "~ advHawk + presHawk", "+", controls, "-factor(admin) - formal + presAttend", sep=" "),  
                 data=nscd_form, family="poisson")
summary(compFit1bf)

compFit1cf = lm(paste(outDiff, "~ advHawk + presHawk", sep=" "),  
                data=nscd_form)
summary(compFit1cf)

compFit1df = lm(paste(outDiff, "~ advHawk + presHawk", "+", controls, "-factor(admin) - formal + presAttend", sep=" "),  
                data=nscd_form)
summary(compFit1df)


## Adviser model with administration fixed effects, without leader hawkishness
compFit2af = glm(paste(outcome, "~ advHawk + factor(admin)", sep=" "),  
                 data=nscd_form, family="poisson")
summary(compFit2af)

compFit2bf = glm(paste(outcome, "~ advHawk", controls, "- formal + presAttend", sep=" "),  
                 data=nscd_form, family="poisson")
summary(compFit2bf)

compFit2cf = lm(paste(outDiff, "~ advHawk + factor(admin)", sep=" "),  
                data=nscd_form)
summary(compFit2cf)

compFit2df = lm(paste(outDiff, "~ advHawk", controls, "- formal + presAttend", sep=" "),  
                data=nscd_form)
summary(compFit2df)


#### Table A12: Effect of Adviser Hawkishness on Foreign Policy Decisions, Using Formal Meetings ####
stargazer(compFit1af, compFit1bf, compFit1cf, compFit1df,
          compFit2af, compFit2bf, compFit2cf, compFit2df,
          column.sep.width = "0pt", no.space=T, align=T, df=F,
          omit = c("mention", "admin"),
          omit.stat = c("ll", "rsq", "adj.rsq", "aic", "f", "ser"),
          covariate.labels = c("Advisers' Hawkishness (Acts)", 
                               "President's Hawkishness", 
                               "No. of Attendees", 
                               "Defense", 
                               "Intelligence", 
                               "Military", 
                               "State", 
                               "Diplomatic Experience", 
                               "Intelligence Experience", 
                               "Military Experience", 
                               "5-Year MID Challenges", 
                               "US CINC",
                               "President Attendance"))


#### Figure A7: Summary of Three Models of Trait Aggregation, Using Formal Meetings ####
plotHawkCoefs("f")
ggsave(filename="./figures/coefPlotFormal.pdf", height=4, width=7, units='in')



#### Meeting analysis for informal meetings only ####

## Emergence model
meanFit1ai = glm(paste(outcome, "~ meanHawk + factor(admin)", sep=" "),  
                 data=nscd_inf, family="poisson")
summary(meanFit1ai)

meanFit1bi = glm(paste(outcome, "~ meanHawk", controls, "-formal", sep=" "),  
                 data=nscd_inf, family="poisson")
summary(meanFit1bi)

meanFit1ci = lm(paste(outDiff, "~ meanHawk + factor(admin)", sep=" "),  
                data=nscd_inf)
summary(meanFit1ci)

meanFit1di = lm(paste(outDiff, "~ meanHawk", controls, "-formal", sep=" "),  
                data=nscd_inf)
summary(meanFit1di)


## Leader model
leaderFit1ai = glm(paste(outcome, "~ presHawk", sep=" "),  
                   data=nscd_inf, family="poisson")
summary(leaderFit1ai)

leaderFit1bi = glm(paste(outcome, "~ presHawk", controls, "-factor(admin) - formal", sep=" "),  
                   data=nscd_inf, family="poisson")
summary(leaderFit1bi)

leaderFit1ci = lm(paste(outDiff, "~ presHawk", sep=" "),  
                  data=nscd_inf)
summary(leaderFit1ci)

leaderFit1di = lm(paste(outDiff, "~ presHawk", controls, "-factor(admin) - formal", sep=" "),  
                  data=nscd_inf)
summary(leaderFit1di)


#### Table A13: Effect of Mean Participant Hawkishness and President's Hawkishness on Foreign Policy Decisions, Using Informal Meetings ####
stargazer(meanFit1ai, meanFit1bi, meanFit1ci, meanFit1di, 
          leaderFit1ai, leaderFit1bi, leaderFit1ci, leaderFit1di,
          column.sep.width = "0pt", no.space=T, align=T, df=F,
          omit = c("mention", "admin"),
          omit.stat = c("ll", "rsq", "adj.rsq", "aic", "f", "ser"),
          covariate.labels = c("Mean Hawkishness", 
                               "No. of Attendees", 
                               "Defense", 
                               "Intelligence", 
                               "Military", 
                               "State", 
                               "Diplomatic Experience", 
                               "Intelligence Experience", 
                               "Military Experience", 
                               "5-Year MID Challenges", 
                               "US CINC",
                               "President's Hawkishness"))


## Adviser model 
compFit1ai = glm(paste(outcome, "~ advHawk + presHawk", sep=" "),  
                 data=nscd_inf, family="poisson")
summary(compFit1ai)

compFit1bi = glm(paste(outcome, "~ advHawk + presHawk", controls, "-factor(admin) - formal", sep=" "),  
                 data=nscd_inf, family="poisson")
summary(compFit1bi)

compFit1ci = lm(paste(outDiff, "~ advHawk + presHawk", sep=" "),  
                data=nscd_inf)
summary(compFit1ci)

compFit1di = lm(paste(outDiff, "~ advHawk + presHawk", controls, "-factor(admin) - formal", sep=" "),  
                data=nscd_inf)
summary(compFit1di)


## Adviser model with administration fixed effects, without leader hawkishness
compFit2ai = glm(paste(outcome, "~ advHawk + factor(admin)", sep=" "),  
                 data=nscd_inf, family="poisson")
summary(compFit2ai)

compFit2bi = glm(paste(outcome, "~ advHawk", controls, "- formal", sep=" "),  
                 data=nscd_inf, family="poisson")
summary(compFit2bi)

compFit2ci = lm(paste(outDiff, "~ advHawk + factor(admin)", sep=" "),  
                data=nscd_inf)
summary(compFit2ci)

compFit2di = lm(paste(outDiff, "~ advHawk", controls, "- formal", sep=" "),  
                data=nscd_inf)
summary(compFit2di)


#### Table A14: Effect of Adviser Hawkishness on Foreign Policy Decisions, Using Informal Meetings ####
stargazer(compFit1ai, compFit1bi, compFit1ci, compFit1di,
          compFit2ai, compFit2bi, compFit2ci, compFit2di,
          column.sep.width = "0pt", no.space=T, align=T, df=F,
          omit = c("mention", "admin"),
          omit.stat = c("ll", "rsq", "adj.rsq", "aic", "f", "ser"),
          covariate.labels = c("Advisers' Hawkishness (Acts)", 
                               "President's Hawkishness", 
                               "No. of Attendees", 
                               "Defense", 
                               "Intelligence", 
                               "Military", 
                               "State", 
                               "Diplomatic Experience", 
                               "Intelligence Experience", 
                               "Military Experience", 
                               "5-Year MID Challenges", 
                               "US CINC"))

#### Figure A7: Summary of Three Models of Trait Aggregation, Using Informal Meetings ####
plotHawkCoefs("i")
ggsave(filename="./figures/coefPlotInformal.pdf", height=4, width=7, units='in')



#### Appendix 5.3: Propagating Uncertainty of Hawkishness Measures ####

# See the "meetingAnalysisIter.R" file.


#### Appendix 5.4: Using an OLS Predictive Model ####

## Emergence model
meanFit1ao = glm(paste(outcome, "~ meanHawkOLS + factor(admin)", "+ formal", sep=" "),  
                 data=nscd_all, family="poisson")
summary(meanFit1ao)

meanFit1bo = glm(paste(outcome, "~ meanHawkOLS", controls, sep=" "),  
                 data=nscd_all, family="poisson")
summary(meanFit1bo)

meanFit1co = lm(paste(outDiff, "~ meanHawkOLS + factor(admin)", "+ formal", sep=" "),  
                data=nscd_all)
summary(meanFit1co)

meanFit1do = lm(paste(outDiff, "~ meanHawkOLS", controls, sep=" "),  
                data=nscd_all)
summary(meanFit1do)


## Leader model
leaderFit1ao = glm(paste(outcome, "~ presHawkOLS", "+ formal", sep=" "),  
                   data=nscd_all, family="poisson")
summary(leaderFit1ao)

leaderFit1bo = glm(paste(outcome, "~ presHawkOLS", controls, "-factor(admin)", sep=" "),  
                   data=nscd_all, family="poisson")
summary(leaderFit1bo)

leaderFit1co = lm(paste(outDiff, "~ presHawkOLS", "+ formal" , sep=" "),  
                  data=nscd_all)
summary(leaderFit1co)

leaderFit1do = lm(paste(outDiff, "~ presHawkOLS", controls, "-factor(admin)", sep=" "),  
                  data=nscd_all)
summary(leaderFit1do)


#### Table A17: Effect of Mean Participant Hawkishness and President's Hawkishness on Foreign Policy Decisions, Using OLS Supervised Learning Model ####
stargazer(meanFit1ao, meanFit1bo, meanFit1co, meanFit1do, 
          leaderFit1ao, leaderFit1bo, leaderFit1co, leaderFit1do,
          column.sep.width = "0pt", no.space=T, align=T, df=F,
          omit = c("mention", "admin"),
          omit.stat = c("ll", "rsq", "adj.rsq", "aic", "f", "ser"),
          covariate.labels = c("Mean Hawkishness", 
                               "No. of Attendees", 
                               "Defense", 
                               "Intelligence", 
                               "Military", 
                               "State", 
                               "Diplomatic Experience", 
                               "Intelligence Experience", 
                               "Military Experience", 
                               "5-Year MID Challenges", 
                               "US CINC",
                               "President's Hawkishness",
                               "Formal"))


## Adviser model 
compFit1ao = glm(paste(outcome, "~ presHawkOLS + advHawkOLS", "+ formal", sep=" "),  
                 data=nscd_all, family="poisson")
summary(compFit1ao)

compFit1bo = glm(paste(outcome, "~ presHawkOLS + advHawkOLS", controls, "-factor(admin)", sep=" "),  
                 data=nscd_all, family="poisson")
summary(compFit1bo)

compFit1co = lm(paste(outDiff, "~ presHawkOLS + advHawkOLS", "+ formal", sep=" "),  
                data=nscd_all)
summary(compFit1co)

compFit1do = lm(paste(outDiff, "~ presHawkOLS + advHawkOLS", controls, "-factor(admin)", sep=" "),  
                data=nscd_all)
summary(compFit1do)


## Adviser model with administration fixed effects, without leader hawkishness
compFit2ao = glm(paste(outcome, "~ advHawkOLS + factor(admin)", "+ formal", sep=" "),  
                 data=nscd_all, family="poisson")
summary(compFit2ao)

compFit2bo = glm(paste(outcome, "~ advHawkOLS", controls, sep=" "),  
                 data=nscd_all, family="poisson")
summary(compFit2bo)

compFit2co = lm(paste(outDiff, "~ advHawkOLS + factor(admin)", "+ formal", sep=" "),  
                data=nscd_all)
summary(compFit2co)

compFit2do = lm(paste(outDiff, "~ advHawkOLS", controls, sep=" "),  
                data=nscd_all)
summary(compFit2do)


#### Table A18: Effect of Adviser Hawkishness on Foreign Policy Decisions, Using OLS Supervised Learning Model ####
stargazer(compFit1ao, compFit1bo, compFit1co, compFit1do,
          compFit2ao, compFit2bo, compFit2co, compFit2do,
          column.sep.width = "0pt", no.space=T, align=T, df=F,
          omit = c("mention", "admin"),
          omit.stat = c("ll", "rsq", "adj.rsq", "aic", "f", "ser"),
          covariate.labels = c("President's Hawkishness", 
                               "Advisers' Hawkishness (Acts)", 
                               "No. of Attendees", 
                               "Defense", 
                               "Intelligence", 
                               "Military", 
                               "State", 
                               "Diplomatic Experience", 
                               "Intelligence Experience", 
                               "Military Experience", 
                               "5-Year MID Challenges", 
                               "US CINC",
                               "Formal"))

#### Figure A10: Summary of Three Models of Trait Aggregation, Using OLS Supervised Learning Model ####
plotHawkCoefs("o")
ggsave(filename="./figures/coefPlotOLS.pdf", height=4, width=7, units='in')




#### Appendix 5.5: Removing Bureaucratic Affiliations ####

# Correlation between the mean hawkishness measures 
cor(nscd_all$meanHawk, nscd_all$meanHawkNoBureau, use='complete.obs') # 0.954


## Emergence model
meanFit1ab = glm(paste(outcome, "~ meanHawkNoBureau + factor(admin)", "+ formal", sep=" "),  
                 data=nscd_all, family="poisson")
summary(meanFit1ab)

meanFit1bb = glm(paste(outcome, "~ meanHawkNoBureau", controls, sep=" "),  
                 data=nscd_all, family="poisson")
summary(meanFit1bb)

meanFit1cb = lm(paste(outDiff, "~ meanHawkNoBureau + factor(admin)", "+ formal", sep=" "),  
                data=nscd_all)
summary(meanFit1cb)

meanFit1db = lm(paste(outDiff, "~ meanHawkNoBureau", controls, sep=" "),  
                data=nscd_all)
summary(meanFit1db)


## Leader model
leaderFit1ab = glm(paste(outcome, "~ presHawkNoBureau", "+ formal", sep=" "),  
                   data=nscd_all, family="poisson")
summary(leaderFit1ab)

leaderFit1bb = glm(paste(outcome, "~ presHawkNoBureau", controls, "-factor(admin)", sep=" "),  
                   data=nscd_all, family="poisson")
summary(leaderFit1bb)

leaderFit1cb = lm(paste(outDiff, "~ presHawkNoBureau", "+ formal", sep=" "),  
                  data=nscd_all)
summary(leaderFit1cb)

leaderFit1db = lm(paste(outDiff, "~ presHawkNoBureau", controls, "-factor(admin)", sep=" "),  
                  data=nscd_all)
summary(leaderFit1db)


#### Table A19: Effect of Mean Participant Hawkishness and President's Hawkishness on Foreign Policy Decisions, Removing Bureaucratic Affiliation from Supervised Learning Model ####
stargazer(meanFit1ab, meanFit1bb, meanFit1cb, meanFit1db, 
          leaderFit1ab, leaderFit1bb, leaderFit1cb, leaderFit1db,
          column.sep.width = "0pt", no.space=T, align=T, df=F,
          omit = c("mention", "admin"),
          omit.stat = c("ll", "rsq", "adj.rsq", "aic", "f", "ser"),
          covariate.labels = c("Mean Hawkishness", 
                               "No. of Attendees", 
                               "Defense", 
                               "Intelligence", 
                               "Military", 
                               "State", 
                               "Diplomatic Experience", 
                               "Intelligence Experience", 
                               "Military Experience", 
                               "5-Year MID Challenges", 
                               "US CINC",
                               "President's Hawkishness",
                               "Formal"))

## Adviser model 
compFit1ab = glm(paste(outcome, "~ advHawkNoBureau + presHawkNoBureau", "+ formal", sep=" "),  
                 data=nscd_all, family="poisson")
summary(compFit1ab)

compFit1bb = glm(paste(outcome, "~ advHawkNoBureau + presHawkNoBureau", controls, "-factor(admin)", sep=" "),  
                 data=nscd_all, family="poisson")
summary(compFit1bb)

compFit1cb = lm(paste(outDiff, "~ advHawkNoBureau + presHawkNoBureau", "+ formal", sep=" "),  
                data=nscd_all)
summary(compFit1cb)

compFit1db = lm(paste(outDiff, "~ advHawkNoBureau + presHawkNoBureau", controls, "-factor(admin)", sep=" "),  
                data=nscd_all)
summary(compFit1db)


## Adviser model with administration fixed effects, without leader hawkishness
compFit2ab = glm(paste(outcome, "~ advHawkNoBureau + factor(admin)", "+ formal", sep=" "),  
                 data=nscd_all, family="poisson")
summary(compFit2ab)

compFit2bb = glm(paste(outcome, "~ advHawkNoBureau", controls, sep=" "),  
                 data=nscd_all, family="poisson")
summary(compFit2bb)

compFit2cb = lm(paste(outDiff, "~ advHawkNoBureau + factor(admin)", "+ formal", sep=" "),  
                data=nscd_all)
summary(compFit2cb)

compFit2db = lm(paste(outDiff, "~ advHawkNoBureau", controls, sep=" "),  
                data=nscd_all)
summary(compFit2db)


#### Table A20: Effect of Adviser Hawkishness on Foreign Policy Decisions, Removing Bureaucratic Affiliation from Supervised Learning Model ####
stargazer(compFit1ab, compFit1bb, compFit1cb, compFit1db,
          compFit2ab, compFit2bb, compFit2cb, compFit2db,
          column.sep.width = "0pt", no.space=T, align=T, df=F,
          omit = c("mention", "admin"),
          omit.stat = c("ll", "rsq", "adj.rsq", "aic", "f", "ser"),
          covariate.labels = c("Advisers' Hawkishness (Acts)", 
                               "President's Hawkishness", 
                               "No. of Attendees", 
                               "Defense", 
                               "Intelligence", 
                               "Military", 
                               "State", 
                               "Diplomatic Experience", 
                               "Intelligence Experience", 
                               "Military Experience", 
                               "5-Year MID Challenges", 
                               "US CINC",
                               "Formal"))


#### Figure A11: Summary of Three Models of Trait Aggregation, Removing Bureaucratic Affiliation from Supervised Learning Model ####
plotHawkCoefs("b")
ggsave(filename="./figures/coefPlotNoBureau.pdf", height=4, width=7, units='in')




#### Appendix 5.6: Removing the Soviet Union ####

## Set up variables
outcomeNoUSSR = "nConfAdv_NoUSSR"
outDiffNoUSSR = "nConfAdv_NoUSSR-nCoopAdv_NoUSSR"


## Emergence model
meanFit1au = glm(paste(outcomeNoUSSR, paste0("~ meanHawk", "+ formal + factor(admin)"), sep=" "),  
                 data=nscd_all, family="poisson")
summary(meanFit1au)

meanFit1bu = glm(paste(outcomeNoUSSR, paste0("~ meanHawk", "+", controls)),  
                 data=nscd_all, family="poisson")
summary(meanFit1bu)

meanFit1cu = lm(paste(outDiffNoUSSR, paste0("~ meanHawk", "+ formal + factor(admin)"), sep=" "),  
                data=nscd_all)
summary(meanFit1cu)

meanFit1du = lm(paste(outDiffNoUSSR, paste0("~ meanHawk", "+", controls)),  
                data=nscd_all)
summary(meanFit1du)


## Leader model
leaderFit1au = glm(paste(outcomeNoUSSR, paste0("~ presHawk", "+ formal"), sep=" "),  
                   data=nscd_all, family="poisson")
summary(leaderFit1au)

leaderFit1bu = glm(paste(outcomeNoUSSR, paste0("~ presHawk", "+", controls, "-factor(admin)", sep=" ")),  
                   data=nscd_all, family="poisson")
summary(leaderFit1bu)

leaderFit1cu = lm(paste(outDiffNoUSSR, paste0("~ presHawk", "+ formal"), sep=" "),  
                  data=nscd_all)
summary(leaderFit1cu)

leaderFit1du = lm(paste(outDiffNoUSSR, paste0("~ presHawk","+", controls, "-factor(admin)", sep=" ")),  
                  data=nscd_all)
summary(leaderFit1du)


#### Table A21: Effect of Mean Participant Hawkishness and President's Hawkishness on Foreign Policy Decisions, Removing Decisions Involving the USSR ####
stargazer(meanFit1au, meanFit1bu, meanFit1cu, meanFit1du, 
          leaderFit1au, leaderFit1bu, leaderFit1cu, leaderFit1du,
          column.sep.width = "0pt", no.space=T, align=T, df=F,
          omit.stat = c("ll", "rsq", "adj.rsq", "aic", "f", "ser"),
          omit = c("mention", "admin"),
          covariate.labels = c("Mean Hawkishness", 
                               "No. of Attendees", 
                               "Defense", 
                               "Intelligence", 
                               "Military", 
                               "State", 
                               "Diplomatic Experience", 
                               "Intelligence Experience", 
                               "Military Experience", 
                               "5-Year MID Challenges", 
                               "US CINC",
                               "President's Hawkishness",
                               "Formal"))


## Adviser model 
compFit1au = glm(paste(outcomeNoUSSR, paste0("~ advHawk + presHawk", "+ formal"), sep=" "),  
                 data=nscd_all, family="poisson")
summary(compFit1au)

compFit1bu = glm(paste(outcomeNoUSSR, paste0("~ advHawk + presHawk","+", controls, "-factor(admin)")),  
                 data=nscd_all, family="poisson")
summary(compFit1bu)

compFit1cu = lm(paste(outDiffNoUSSR, paste0("~ advHawk + presHawk", "+ formal"), sep=" "),  
                data=nscd_all)
summary(compFit1cu)

compFit1du = lm(paste(outDiffNoUSSR, paste0("~ advHawk + presHawk", "+", controls, "-factor(admin)")),  
                data=nscd_all)
summary(compFit1du)


## Adviser model with administration fixed effects, without leader hawkishness
compFit2au = glm(paste(outcomeNoUSSR, paste0("~ advHawk", "+ formal + factor(admin)"), sep=" "),  
                 data=nscd_all, family="poisson")
summary(compFit2au)

compFit2bu = glm(paste(outcomeNoUSSR, paste0("~ advHawk", "+", controls)),  
                 data=nscd_all, family="poisson")
summary(compFit2bu)

compFit2cu = lm(paste(outDiffNoUSSR, paste0("~ advHawk", "+ formal + factor(admin)"), sep=" "),  
                data=nscd_all)
summary(compFit2cu)

compFit2du = lm(paste(outDiffNoUSSR, paste0("~ advHawk", "+", controls)),  
                data=nscd_all)
summary(compFit2du)


#### Table A22: Effect of Adviser Hawkishness on Foreign Policy Decisions, Removing Decisions Involving the USSR ####
stargazer(compFit1au, compFit1bu, compFit1cu, compFit1du,
          compFit2au, compFit2bu, compFit2cu, compFit2du,
          column.sep.width = "0pt", no.space=T, align=T, df=F,
          omit.stat = c("ll", "rsq", "adj.rsq", "aic", "f", "ser"),
          omit = c("mention", "admin"),
          covariate.labels = c("Advisers' Hawkishness (Acts)", 
                               "President's Hawkishness", 
                               "No. of Attendees", 
                               "Defense", 
                               "Intelligence", 
                               "Military", 
                               "State", 
                               "Diplomatic Experience", 
                               "Intelligence Experience", 
                               "Military Experience", 
                               "5-Year MID Challenges", 
                               "US CINC",
                               "Formal"))

#### Figure A12: Summary of Three Models of Trait Aggregation, Removing Decisions Involving the USSR ####
plotHawkCoefs("u")
ggsave(filename="./figures/coefPlotNoUSSR.pdf", height=4, width=7, units='in')



#### Appendix 5.7: Negative Binomial ####

# Mean and variance of the main conflictual decisions variable
mean(nscd_all$nConfAdv) # 0.261
var(nscd_all$nConfAdv)  # 0.490


# Dispersion tests to see whether negative binomial models are appropriate
AER::dispersiontest(meanFit1a)   # p = 0.001
AER::dispersiontest(leaderFit1a) # p = 0.001
AER::dispersiontest(compFit1a)   # p = 0.0005
AER::dispersiontest(compFit2a)   # p = 0.0006
AER::dispersiontest(meanFit1b)   # p = 0.0001
AER::dispersiontest(leaderFit1b) # p << 0.01
AER::dispersiontest(compFit1b)   # p << 0.01
AER::dispersiontest(compFit2b)   # p << 0.01


## Emergence model
meanFit1an = glm.nb(paste(outcome, "~ meanHawk + formal + factor(admin)", sep=" "),  
                    data=nscd_all)
summary(meanFit1an)

meanFit1bn = glm.nb(paste(outcome, "~ meanHawk", controls, sep=" "),  
                    data=nscd_all)
summary(meanFit1bn)


## Leader model
leaderFit1an = glm.nb(paste(outcome, "~ presHawk + formal", sep=" "),  
                      data=nscd_all)
summary(leaderFit1an)

leaderFit1bn = glm.nb(paste(outcome, "~ presHawk", controls, "-factor(admin)", sep=" "),  
                      data=nscd_all)
summary(leaderFit1bn)


#### Table A23: Effect of Mean Participant Hawkishness and President's Hawkishness on Foreign Policy Decisions, Using Negative Binomial Models ####
stargazer(meanFit1an, meanFit1bn, leaderFit1an, leaderFit1bn, 
          column.sep.width = "0pt", no.space=T, align=T, df=F,
          omit = c("mention", "admin"),
          omit.stat = c("ll", "rsq", "adj.rsq", "aic", "f", "ser"),
          covariate.labels = c("Mean Hawkishness", 
                               "No. of Attendees", 
                               "Defense", 
                               "Intelligence", 
                               "Military", 
                               "State", 
                               "Diplomatic Experience", 
                               "Intelligence Experience", 
                               "Military Experience", 
                               "5-Year MID Challenges", 
                               "US CINC",
                               "President's Hawkishness",
                               "Formal"))

## Adviser model 
compFit1an = glm.nb(paste(outcome, "~ advHawk + presHawk + formal", sep=" "),  
                    data=nscd_all)
summary(compFit1an)

compFit1bn = glm.nb(paste(outcome, "~ advHawk + presHawk", controls, "-factor(admin)", sep=" "),  
                    data=nscd_all)
summary(compFit1bn)

## Adviser model with administration fixed effects, without leader hawkishness
compFit2an = glm.nb(paste(outcome, "~ advHawk + formal + factor(admin)", sep=" "),  
                    data=nscd_all)
summary(compFit2an)

compFit2bn = glm.nb(paste(outcome, "~ advHawk", controls, sep=" "),  
                    data=nscd_all)
summary(compFit2bn)


#### Table A24: Effect of Adviser Hawkishness on Foreign Policy Decisions, Using Negative Binomial Models ####
stargazer(compFit1an, compFit1bn, 
          compFit2an, compFit2bn, 
          column.sep.width = "0pt", no.space=T, align=T, df=F,
          omit = c("mention", "admin"),
          omit.stat = c("ll", "rsq", "adj.rsq", "aic", "f", "ser"),
          covariate.labels = c("Advisers' Hawkishness (Acts)", 
                               "President's Hawkishness", 
                               "No. of Attendees", 
                               "Defense", 
                               "Intelligence", 
                               "Military", 
                               "State", 
                               "Diplomatic Experience", 
                               "Intelligence Experience", 
                               "Military Experience", 
                               "5-Year MID Challenges", 
                               "US CINC",
                               "Formal"))

#### Figure A13: Summary of Three Models of Trait Aggregation, Using Negative Binomial Models ####
plotNBHawkCoefs("")
ggsave(filename="./figures/coefPlotNegBin.pdf", height=4, width=7, units='in')


#### Appendix 5.8: Time-Unit Replication Analysis ####

# See the "monthlyAnalysis.R" file.


#### Appendix 5.8.1: Propagating Uncertainty of Hawkishness Measures in Time-Unit Analysis ####

# See the "monthlyAnalysisIter.R" file.


#### Appendix 5.9: Statutory Members Only ####

## Emergence model
meanFit1ak = glm(paste(outcome, "~ meanHawkKey + factor(admin)", sep=" "),  
                 data=nscd_form, family="poisson")
summary(meanFit1ak)

meanFit1bk = glm(paste(outcome, "~ meanHawkKey", controls, "- formal", sep=" "),  
                 data=nscd_form, family="poisson")
summary(meanFit1bk)

meanFit1ck = lm(paste(outDiff, "~ meanHawkKey + factor(admin)", sep=" "),  
                data=nscd_form)
summary(meanFit1ck)

meanFit1dk = lm(paste(outDiff, "~ meanHawkKey", controls, "- formal", sep=" "),  
                data=nscd_form)
summary(meanFit1dk)


## Leader model
leaderFit1ak = glm(paste(outcome, "~ presHawkKey", sep=" "),  
                   data=nscd_form, family="poisson")
summary(leaderFit1ak)

leaderFit1bk = glm(paste(outcome, "~ presHawkKey", controls, "-factor(admin) - formal", sep=" "),  
                   data=nscd_form, family="poisson")
summary(leaderFit1bk)

leaderFit1ck = lm(paste(outDiff, "~ presHawkKey", sep=" "),  
                  data=nscd_form)
summary(leaderFit1ck)

leaderFit1dk = lm(paste(outDiff, "~ presHawkKey", controls, "-factor(admin) - formal", sep=" "),  
                  data=nscd_form)
summary(leaderFit1dk)


#### Table A27: Effect of Mean Participant Hawkishness and President's Hawkishness on Foreign Policy Decisions, Using Only Statutory NSC Members in Formal Meetings ####
stargazer(meanFit1ak, meanFit1bk, meanFit1ck, meanFit1dk, 
          leaderFit1ak, leaderFit1bk, leaderFit1ck, leaderFit1dk,
          column.sep.width = "0pt", no.space=T, align=T, df=F,
          omit = c("mention", "admin"),
          omit.stat = c("ll", "rsq", "adj.rsq", "aic", "f", "ser"),
          covariate.labels = c("Mean Hawkishness", 
                               "No. of Attendees", 
                               "Defense", 
                               "Intelligence", 
                               "Military", 
                               "State", 
                               "Diplomatic Experience", 
                               "Intelligence Experience", 
                               "Military Experience", 
                               "5-Year MID Challenges", 
                               "US CINC",
                               "President's Hawkishness"))


## Adviser model 
compFit1ak = glm(paste(outcome, "~ advHawkKey + presHawkKey", sep=" "),  
                 data=nscd_form, family="poisson")
summary(compFit1ak)

compFit1bk = glm(paste(outcome, "~ advHawkKey + presHawkKey", controls, "-factor(admin) - formal", sep=" "),  
                 data=nscd_form, family="poisson")
summary(compFit1bk)

compFit1ck = lm(paste(outDiff, "~ advHawkKey + presHawkKey", sep=" "),  
                data=nscd_form)
summary(compFit1ck)

compFit1dk = lm(paste(outDiff, "~ advHawkKey + presHawkKey", controls, "-factor(admin) - formal", sep=" "),  
                data=nscd_form)
summary(compFit1dk)


## Adviser model with administration fixed effects, without leader hawkishness
compFit2ak = glm(paste(outcome, "~ advHawkKey + factor(admin)", sep=" "),  
                 data=nscd_form, family="poisson")
summary(compFit2ak)

compFit2bk = glm(paste(outcome, "~ advHawkKey", controls, "- formal", sep=" "),  
                 data=nscd_form, family="poisson")
summary(compFit2bk)

compFit2ck = lm(paste(outDiff, "~ advHawkKey + factor(admin)", sep=" "),  
                data=nscd_form)
summary(compFit2ck)

compFit2dk = lm(paste(outDiff, "~ advHawkKey", controls, "- formal", sep=" "),  
                data=nscd_form)
summary(compFit2dk)

#### Table A28: Effect of Adviser Hawkishness on Foreign Policy Decisions, Using Only Statutory NSC Members in Formal Meetings ####
stargazer(compFit1ak, compFit1bk, compFit1ck, compFit1dk,
          compFit2ak, compFit2bk, compFit2ck, compFit2dk,
          column.sep.width = "0pt", no.space=T, align=T, df=F,
          omit = c("mention", "admin"),
          omit.stat = c("ll", "rsq", "adj.rsq", "aic", "f", "ser"),
          covariate.labels = c("Advisers' Hawkishness (Acts)", 
                               "President's Hawkishness", 
                               "No. of Attendees", 
                               "Defense", 
                               "Intelligence", 
                               "Military", 
                               "State", 
                               "Diplomatic Experience", 
                               "Intelligence Experience", 
                               "Military Experience", 
                               "5-Year MID Challenges", 
                               "US CINC"))


### Make coefficient plots
plotHawkCoefs("k")
ggsave(filename="./figures/coefPlotFormalStatutory.pdf", height=4, width=7, units='in')



#### Appendix 5.10: Crisis Period Analysis ####

## Adviser model 
compFit1bc = glm(paste(outcome, "~ advHawk*incrisis + presHawk", controls, "-factor(admin)", sep=" "),  
                 data=nscd_all, family="poisson")
summary(compFit1bc)

compFit1dc = lm(paste(outDiff, "~ advHawk*incrisis + presHawk", controls, "-factor(admin)", sep=" "),  
                data=nscd_all)
summary(compFit1dc)

## Adviser model with administration fixed effects, without leader hawkishness
compFit2bc = glm(paste(outcome, "~ advHawk*incrisis", controls, sep=" "),  
                 data=nscd_all, family="poisson")
summary(compFit2bc)

compFit2dc = lm(paste(outDiff, "~ advHawk*incrisis", controls, sep=" "),  
                data=nscd_all)
summary(compFit2dc)

#### Table A29: Effect of Adviser Hawkishness on Foreign Policy Decisions, Including Interaction Term for Crisis Periods ####
stargazer(compFit1bc, compFit1dc,
          compFit2bc, compFit2dc,
          column.sep.width = "0pt", no.space=T, align=T, df=F,
          omit = c("mention", "admin"),
          omit.stat = c("ll", "rsq", "adj.rsq", "aic", "f", "ser"),
          covariate.labels = c("Advisers' Hawkishness (Acts)", 
                               "Crisis",
                               "President's Hawkishness", 
                               "No. of Attendees", 
                               "Defense", 
                               "Intelligence", 
                               "Military", 
                               "State", 
                               "Diplomatic Experience", 
                               "Intelligence Experience", 
                               "Military Experience", 
                               "5-Year MID Challenges", 
                               "US CINC",
                               "Formal",
                               "Advisers $\\times$ Crisis"))


#### Appendix 5.11: Adviser Experience and Dispositional Distance Analysis ####

# Very high correlation between the experience gap and the interaction term
cor(nscd_all$leadAdvDiffExp, nscd_all$advHawk*nscd_all$leadAdvDiffExp, use='complete.obs')
cor(scale(nscd_all$leadAdvDiffExp), scale(nscd_all$advHawk)*scale(nscd_all$leadAdvDiffExp), use='complete.obs') # Mitigate this by scaling

## Adviser model 
compFit1bg = glm(paste(outcome, "~ scale(advHawk) * scale(leadAdvDiffExp) + presHawk", controls, "-factor(admin)", sep=" "),  
                 data=nscd_all, family="poisson")
summary(compFit1bg)

compFit1dg = lm(paste(outDiff, "~ scale(advHawk) * scale(leadAdvDiffExp) + presHawk", controls, "-factor(admin)", sep=" "),  
                data=nscd_all)
summary(compFit1dg)

# Setting apart leaders and advisers, weighted (but remove president's hawkishness due to multicollinearity issues)
compFit2bg = glm(paste(outcome, "~ scale(advHawk) * scale(leadAdvDiffExp)", controls, "-factor(admin)", sep=" "),  
                 data=nscd_all, family="poisson")
summary(compFit2bg)

compFit2dg = lm(paste(outDiff, "~ scale(advHawk) * scale(leadAdvDiffExp)", controls, "-factor(admin)", sep=" "),  
                data=nscd_all)
summary(compFit2dg)


## Adviser model with administration fixed effects, without leader hawkishness
compFit3bg = glm(paste(outcome, "~ scale(advHawk) * scale(leadAdvDiffExp)", controls, sep=" "),  
                 data=nscd_all, family="poisson")
summary(compFit3bg)

compFit3dg = lm(paste(outDiff, "~ scale(advHawk) * scale(leadAdvDiffExp)", controls, sep=" "),  
                data=nscd_all)
summary(compFit3dg)

#### Table A30: Effect of Adviser Hawkishness on Foreign Policy Decisions, Including Interaction Term for Leader-Adviser Experience Gap ####
stargazer(compFit1bg, compFit1dg,
          compFit2bg, compFit2dg,
          compFit3bg, compFit3dg,
          column.sep.width = "0pt", no.space=T, align=T, df=F,
          omit = c("mention", "admin"),
          omit.stat = c("ll", "rsq", "adj.rsq", "aic", "f", "ser"),
          covariate.labels = c("Advisers' Hawkishness (Acts)", 
                               "Experience Gap",
                               "President's Hawkishness", 
                               "No. of Attendees", 
                               "Defense", 
                               "Intelligence", 
                               "Military", 
                               "State", 
                               "Diplomatic Experience", 
                               "Intelligence Experience", 
                               "Military Experience", 
                               "5-Year MID Challenges", 
                               "US CINC",
                               "Formal",
                               "Advisers $\\times$ Exp. Gap"))


# Very high correlation between the experience gap and the interaction term
cor(nscd_all$presHawk, nscd_all$presHawk*nscd_all$advHawk, use="complete.obs")
cor(scale(nscd_all$presHawk), scale(nscd_all$presHawk)*scale(nscd_all$advHawk), use="complete.obs") # Mitigate this by scaling

## Adviser model 
compFit1ax = glm(paste(outcome, "~ scale(advHawk) * scale(presHawk)", sep=" "),  
                 data=nscd_all, family="poisson")
summary(compFit1ax)

compFit1bx = glm(paste(outcome, "~ scale(advHawk) * scale(presHawk)", controls, "-factor(admin)", sep=" "),  
                 data=nscd_all, family="poisson")
summary(compFit1bx)

compFit1cx = lm(paste(outDiff, "~ scale(advHawk) * scale(presHawk)", sep=" "),  
                data=nscd_all)
summary(compFit1cx)

compFit1dx = lm(paste(outDiff, "~ scale(advHawk) * scale(presHawk)", controls, "-factor(admin)", sep=" "),  
                data=nscd_all)
summary(compFit1dx)

#### Table A31: Effect of Interaction between Adviser Hawkishness and Leader Hawkishness on Foreign Policy Decisions ####
stargazer(compFit1ax, compFit1bx, compFit1cx, compFit1dx,
          column.sep.width = "0pt", no.space=T, align=T, df=F,
          omit = c("mention", "admin"),
          omit.stat = c("ll", "rsq", "adj.rsq", "aic", "f", "ser"),
          covariate.labels = c("Advisers' Hawkishness (Acts)", 
                               "President's Hawkishness",
                               "No. of Attendees", 
                               "Defense", 
                               "Intelligence", 
                               "Military", 
                               "State", 
                               "Diplomatic Experience", 
                               "Intelligence Experience", 
                               "Military Experience", 
                               "5-Year MID Challenges", 
                               "US CINC",
                               "Formal",
                               "Adv. Hawk. $\\times$ Pres. Hawk."))



#### Appendix 6: Discussion of Leader results ####

# Are the leader results the result of high correlation between leader and advisers?
cor(nscd_all$presHawk, nscd_all$advHawk, use='complete.obs') # 0.276

#### Table A32: Variance Inflation Factors for Key Covariates ####
data.frame(car::vif(compFit1a))[c("advHawk", "presHawk"),] # 1.148, 1.098
data.frame(car::vif(compFit1b))[c("advHawk", "presHawk"),] # 1.859, 2.809
data.frame(car::vif(compFit1c))[c("advHawk", "presHawk"),] # 1.155, 1.083
data.frame(car::vif(compFit1d))[c("advHawk", "presHawk"),] # 1.788, 2.640

car::vif(compFit2a)[c("advHawk", "factor(admin)"),] # 1.311, 1.046
car::vif(compFit2b)[c("advHawk", "factor(admin)"),] # 1.570, 1.495 
car::vif(compFit2c)[c("advHawk", "factor(admin)"),] # 1.258, 1.042
car::vif(compFit2d)[c("advHawk", "factor(admin)"),] # 1.478, 1.489


#### Appendix 7.1: Expert Survey Results ####

## Leader model
leaderFit1ae = glm(paste(outcome, "~ presHawkExpert + formal", sep=" "),  
                   data=nscd_all, family="poisson")
summary(leaderFit1ae)

leaderFit1be = glm(paste(outcome, "~ presHawkExpert", controls, "-factor(admin)", sep=" "),  
                   data=nscd_all, family="poisson")
summary(leaderFit1be)

leaderFit1ce = lm(paste(outDiff, "~ presHawkExpert + formal", sep=" "),  
                  data=nscd_all)
summary(leaderFit1ce)

leaderFit1de = lm(paste(outDiff, "~ presHawkExpert", controls, "-factor(admin)", sep=" "),  
                  data=nscd_all)
summary(leaderFit1de)

## Adviser model 
compFit1ae = glm(paste(outcome, "~ presHawkExpert + advHawk + formal", sep=" "),  
                 data=nscd_all, family="poisson")
summary(compFit1ae)

compFit1be = glm(paste(outcome, "~ presHawkExpert + advHawk", controls, "-factor(admin)", sep=" "),  
                 data=nscd_all, family="poisson")
summary(compFit1be)

compFit1ce = lm(paste(outDiff, "~ presHawkExpert + advHawk + formal", sep=" "),  
                data=nscd_all)
summary(compFit1ce)

compFit1de = lm(paste(outDiff, "~ presHawkExpert + advHawk", controls, "-factor(admin)", sep=" "),  
                data=nscd_all)
summary(compFit1de)

#### Table A33: Effect of President's Hawkishness on Foreign Policy Decisions, Using Expert Codings ####
stargazer(leaderFit1ae, leaderFit1be, leaderFit1ce, leaderFit1de, 
          compFit1ae, compFit1be, compFit1ce, compFit1de,
          column.sep.width = "0pt", no.space=T, align=T, df=F,
          omit = c("mention", "admin"),
          omit.stat = c("ll", "rsq", "adj.rsq", "aic", "f", "ser"),
          covariate.labels = c("President's Hawkishness",
                               "No. of Attendees", 
                               "Defense", 
                               "Intelligence", 
                               "Military", 
                               "State", 
                               "Diplomatic Experience", 
                               "Intelligence Experience", 
                               "Military Experience", 
                               "5-Year MID Challenges", 
                               "US CINC",
                               "Advisers' Hawkishness (Acts)", 
                               "Formal"))

#### Figure A15: Summary of Two Models of Trait Aggregation, Using Expert Codings ####

fig5e <- data.frame(y=c(coef(leaderFit1ae)[2], coef(leaderFit1be)[2], 
                        coef(leaderFit1ce)[2], coef(leaderFit1de)[2], 
                        coef(compFit1ae)[2], coef(compFit1be)[2],
                        coef(compFit1ce)[2], coef(compFit1de)[2]), 
                    se=c(sqrt(diag(vcov(leaderFit1ae)))[2], sqrt(diag(vcov(leaderFit1be)))[2], 
                         sqrt(diag(vcov(leaderFit1ce)))[2], sqrt(diag(vcov(leaderFit1de)))[2], 
                         sqrt(diag(vcov(compFit1ae)))[2], sqrt(diag(vcov(compFit1be)))[2],
                         sqrt(diag(vcov(compFit1ce)))[2], sqrt(diag(vcov(compFit1de)))[2]))
fig5e$low=fig5e$y-1.96*fig5e$se
fig5e$low10=fig5e$y-1.69*fig5e$se
fig5e$high=fig5e$y+1.96*fig5e$se
fig5e$high10=fig5e$y+1.69*fig5e$se

fig5e$Model <- c("Sparse", "With controls")
fig5e$Mechanism <- rep(c("Leader Model\n(Coefficient for President)", "Adviser Model\n(Coefficient for President)"),each=4)
fig5e$label = rep(c("Conf. (Poisson), Sparse", "Conf. (Poisson), Full", "Conf.-Coop. (OLS), Sparse", "Conf.-Coop. (OLS), Full"), 2)
fig5e$Mechanism <- factor(fig5e$Mechanism, 
                          levels=c("Leader Model\n(Coefficient for President)", "Adviser Model\n(Coefficient for President)"))
fig5e$x <- rep(c("Conf.\n(Poisson)\nSparse", "Conf.\n(Poisson)\nFull", "Conf.-Coop.\n(OLS)\nSparse", "Conf.-Coop.\n(OLS)\nFull"), 2)
fig5e$x = factor(fig5e$x, levels=c("Conf.\n(Poisson)\nSparse", "Conf.\n(Poisson)\nFull", "Conf.-Coop.\n(OLS)\nSparse", "Conf.-Coop.\n(OLS)\nFull"))

ggplot(fig5e, aes(x=x,y=y)) + 
  geom_pointrange(aes(ymin=low, ymax=high, color=label)) + 
  geom_linerange(aes(ymin=low10, ymax=high10, color=label), linewidth=1.5) + 
  geom_hline(yintercept=0, linetype=2) + theme_bw() + ylab("Coefficient Estimate") + 
  xlab("Model") + 
  scale_color_manual("Model", values=c("royalblue3", "dodgerblue", "red3", "tomato")) + facet_grid(cols=vars(Mechanism)) +
  theme(legend.position="none", axis.text.x = element_text(angle=90, vjust=0.5))

ggsave(filename="./figures/coefPlotExpert.pdf", height=4, width=7, units='in')
